<extend name="../app/Admin/View/default/common/dashboard_layout.html"/>

<block name="content">
    <form action="/admin/coder/generate/id/ContentCate" method="post" id="form" class="form-horizontal form builder-form">
        <input type="hidden" name="id" value="{$id}"/>
    <section class="content-header clearfix">
        <h1 class="pull-left">{$meta_title}</h1>
        <div class="pull-right">
            <a class="btn btn-primary btn-sm" href="{:U('/admin/coder/coderLog', array('id' => 'ContentCate'))}">生成记录</a>
             <button type="button" id="save_btn" class="btn btn-primary btn-sm">保存记录</button>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-save"></i> 生成代码</button>
        </div>
    </section>
    
    <div class="builder builder-form-box panel-body content" n-id="301">
        
        <input type="hidden" name="log_id" value="{$log_id}" />
        
        <ul class="nav nav-tabs">
            <li class="active"><a href="#content-inf" data-toggle="tab">内容设置</a></li>
            <li><a href="#cate-inf" data-toggle="tab">分类设置</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="content-inf" >
                <div class="builder-container builder-form-container">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">内容控制器标识：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='content_controller_name' value='{$coder_log.content_controller_name}' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">菜单标题：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='menu_title' value='{$coder_log.menu_title}' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">菜单图标：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='menu_icon' value='{$coder_log.menu_icon}' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">内容表名：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='content_table_name' value='{$coder_log.content_table_name}' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <input type='checkbox' name='action' value='save' <php>if($coder_log['action'] == 'save') echo 'checked="true"';</php> id="save_cb">保存
                                
                            </div>
                            <php>if($coder_log['action'] == 'save'){</php>
                                <input type='text' name='save_btn_title' value='<php>echo $coder_log["save_btn_title"];</php>' id='save_btn_title'>
                            <php>}</php>
                        </div>
                        
                    </div>
                    <h1>内容自定义字段:</h1>
                    <php>$content_list_show_num = 0;</php>
                    <php>$content_add_show_num = 0;</php>
                    <php>for($cus_i=0;$cus_i<count($coder_log['content_column_name']);$cus_i++){</php>
                    <div class='row box box-solid'>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">字段名：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='content_column_name[]' value='<php> echo $coder_log["content_column_name"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">字段类型：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='content_column_type[]' value='<php> echo $coder_log["content_column_type"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">必填：</label>
                                <div class="right">
                                    <select name='content_require[]'>
                                        <option value='1' <php>if($coder_log['content_require'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['content_require'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">注释：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='content_comment[]' value='<php> echo $coder_log["content_comment"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12 list_show_div">
                            <div class='form-group'>
                                <label class="left control-label">list show?：</label>
                                <div class="right">
                                    <select name='content_list_show[]' class='list_show' prefix='content_'>
                                        <option value='1' <php>if($coder_log['content_list_show'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['content_list_show'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>if($coder_log['content_list_show'][$cus_i] == "1"){</php>
                        <div class="col-xs-12 list_show_type_div">
                            <div class='form-group'>
                                <label class="left control-label">调用类型：</label>
                                <div class="right">
                                    <select name="content_list_show_type[]">
                                        <option value='' <php>if($coder_log['content_list_show_type'][$content_list_show_num] == "") echo 'selected="true"';</php>>无</option> 
                                        <option value='picture' <php>if($coder_log['content_list_show_type'][$content_list_show_num] == "picture") echo 'selected="true"';</php>>图片</option> 
                                        <option value='fun' <php>if($coder_log['content_list_show_type'][$content_list_show_num] == "fun") echo 'selected="true"';</php>>函数</option>
                                        <option value='status' <php>if($coder_log['content_list_show_type'][$content_list_show_num] == "status") echo 'selected="true"';</php>>状态</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">调用函数：(只有函数类型需要填写)</label>
                                <div class="right">
                                    <input type='text' name="content_list_show_fun[]" value='<php> echo $coder_log["content_list_show_fun"][$content_list_show_num];</php>' >
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">可修改?</label>
                                <div class="right">
                                    <select name="content_list_edit[]">
                                        <option value='' <php>if($coder_log['content_list_edit'][$content_list_show_num] == "") echo 'selected="true"';</php>>否</option>
                                        <option value='1' <php>if($coder_log['content_list_edit'][$content_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">下拉查询?</label>
                                <div class="right">
                                    <select name="content_list_show_select_search[]">
                                        <option value='' <php>if($coder_log['content_list_show_select_search'][$content_list_show_num] == "") echo 'selected="true"';</php>>否</option>
                                        <option value='1' <php>if($coder_log['content_list_show_select_search'][$content_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">下拉查询函数?</label>
                                <div class="right">
                                    <input type='text' name="content_list_show_select_options_fun[]" value='<php> echo $coder_log["content_list_show_select_options_fun"][$content_list_show_num];</php>' />
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">模糊查询?</label>
                                <div class="right">
                                    <select name="content_list_show_like_search[]">
                                        <option value='' <php>if($coder_log['content_list_show_like_search'][$content_list_show_num] == "") echo 'selected="true"';</php> >否</option>
                                        <option value='1' <php>if($coder_log['content_list_show_like_search'][$content_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>$content_list_show_num++;</php>
                        <php>}</php>
                        <div class="col-xs-12 add_show_div">
                            <div class='form-group'>
                                <label class="left control-label">add show?：</label>
                                <div class="right">
                                     <select name='content_add_show[]' class='add_show' prefix='content_'>
                                        <option value='1' <php>if($coder_log['content_add_show'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['content_add_show'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>if($coder_log['content_add_show'][$cus_i] == "1"){</php>
                        <div class="col-xs-12 add_show_type_div">
                            <div class='form-group'>
                                <label class="left control-label">字段类型：</label>
                                <div class="right">
                                    <select name="content_add_show_type[]">
                                        <volist name=":C('FORM_ITEM_TYPE')" id="type">
                                            <option value='{$key}' <php>if($coder_log['content_add_show_type'][$content_add_show_num] == $key) echo 'selected="true"';</php>>{$type.0}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">调用函数：(只有checkbox 或者 select等类型需要填写)</label>
                                <div class="right">
                                    <input type='text' name="content_add_show_options_fun[]" value='<php> echo $coder_log["content_add_show_options_fun"][$content_add_show_num];</php>'>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">extra_attr</label>
                                <div class="right">
                                    <input type='text' name="content_add_show_extra_attr[]" value='<php> echo $coder_log["content_add_show_extra_attr"][$content_add_show_num];</php>'>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">默认值</label>
                                <div class="right">
                                    <input type='text' name="content_add_show_default[]" value='<php> echo $coder_log["content_add_show_default"][$content_add_show_num];</php>'>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">tips:</label>
                                <div class="right">
                                    <input type='text' name="content_add_show_tips[]" value='<php> echo $coder_log["content_add_show_tips"][$content_add_show_num];</php>'>
                                </div>
                            </div>
                        </div>
                        <php>$content_add_show_num++;</php>
                        <php>}</php>
                        <div class="col-xs-12">
                            <button type="button" class="btn btn-danger btn-xs pull-right" onclick="$(this).parents('.box').remove();">删除</button>
                        </div>
                    </div>
                    <php>}</php>
                    <div class='row add-panel' >
                        <button type="button" class="btn btn-sm btn-default addField" prefix='content_'>增加一行</button>
                    </div>
                </div>
            </div>
            <div class="tab-pane" id="cate-inf">
                <div class="builder-container builder-form-container">
                    <h1>分类自定义字段:</h1>
                    <php>$cate_list_show_num = 0;</php>
                    <php>$cate_add_show_num = 0;</php>
                    <php>for($cus_i=0;$cus_i<count($coder_log['cate_column_name']);$cus_i++){</php>
                    <div class='row box box-solid'>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">字段名：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='cate_column_name[]' value='<php> echo $coder_log["cate_column_name"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">字段类型：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='cate_column_type[]' value='<php> echo $coder_log["cate_column_type"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">必填：</label>
                                <div class="right">
                                    <select name='cate_require[]'>
                                        <option value='1' <php>if($coder_log['cate_require'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['cate_require'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <div class='form-group'>
                                <label class="left control-label">注释：</label>
                                <div class="right">
                                    <input type='text' class="form-control input text" name='cate_comment[]' value='<php> echo $coder_log["cate_comment"][$cus_i];</php>' />
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-12 list_show_div">
                            <div class='form-group'>
                                <label class="left control-label">list show?：</label>
                                <div class="right">
                                    <select name='cate_list_show[]' class='list_show' prefix='cate_'>
                                        <option value='1' <php>if($coder_log['cate_list_show'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['cate_list_show'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>if($coder_log['cate_list_show'][$cus_i] == "1"){</php>
                        <div class="col-xs-12 list_show_type_div">
                            <div class='form-group'>
                                <label class="left control-label">调用类型：</label>
                                <div class="right">
                                    <select name="cate_list_show_type[]">
                                        <option value='' <php>if($coder_log['cate_list_show_type'][$cate_list_show_num] == "") echo 'selected="true"';</php>>无</option> 
                                        <option value='picture' <php>if($coder_log['cate_list_show_type'][$cate_list_show_num] == "picture") echo 'selected="true"';</php>>图片</option> 
                                        <option value='fun' <php>if($coder_log['cate_list_show_type'][$cate_list_show_num] == "fun") echo 'selected="true"';</php>>函数</option>
                                        <option value='status' <php>if($coder_log['cate_list_show_type'][$cate_list_show_num] == "status") echo 'selected="true"';</php>>状态</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">调用函数：(只有函数类型需要填写)</label>
                                <div class="right">
                                    <input type='text' name="cate_list_show_fun[]" value='<php> echo $coder_log["cate_list_show_fun"][$cate_list_show_num];</php>'>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">可修改?</label>
                                <div class="right">
                                    <select name="cate_list_edit[]">
                                        <option value='' <php>if($coder_log['cate_list_edit'][$cate_list_show_num] == "") echo 'selected="true"';</php>>否</option>
                                        <option value='1' <php>if($coder_log['cate_list_edit'][$cate_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">下拉查询?</label>
                                <div class="right">
                                    <select name="cate_list_show_select_search[]">
                                        <option value='' <php>if($coder_log['cate_list_show_select_search'][$cate_list_show_num] == "") echo 'selected="true"';</php>>否</option>
                                        <option value='1' <php>if($coder_log['cate_list_show_select_search'][$cate_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">下拉查询函数?</label>
                                <div class="right">
                                    <input type='text' name="cate_list_show_select_options_fun[]" value='<php> echo $coder_log["cate_list_show_select_options_fun"][$cate_list_show_num];</php>' />
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">模糊查询?</label>
                                <div class="right">
                                    <select name="cate_list_show_like_search[]">
                                        <option value='' <php>if($coder_log['cate_list_show_like_search'][$cate_list_show_num] == "") echo 'selected="true"';</php>>否</option>
                                        <option value='1' <php>if($coder_log['cate_list_show_like_search'][$cate_list_show_num] == "1") echo 'selected="true"';</php>>是</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>$cate_list_show_num++;</php>
                        <php>}</php>
                        <div class="col-xs-12 add_show_div">
                            <div class='form-group'>
                                <label class="left control-label">add show?：</label>
                                <div class="right">
                                     <select name='cate_add_show[]' class='add_show' prefix='cate_'>
                                        <option value='1' <php>if($coder_log['cate_add_show'][$cus_i] == "1") echo 'selected="true"';</php>>是</option>
                                        <option value='0' <php>if($coder_log['cate_add_show'][$cus_i] == "0") echo 'selected="true"';</php>>否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <php>if($coder_log['cate_add_show'][$cus_i] == "1"){</php>
                        <div class="col-xs-12 add_show_type_div">
                            <div class='form-group'>
                                <label class="left control-label">字段类型：</label>
                                <div class="right">
                                    <select name="cate_add_show_type[]">
                                        <volist name=":C('FORM_ITEM_TYPE')" id="type">
                                            <option value='{$key}' <php>if($coder_log['cate_add_show_type'][$cate_add_show_num] == $key) echo 'selected="true"';</php>>{$type.0}</option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">调用函数：(只有checkbox 或者 select等类型需要填写)</label>
                                <div class="right">
                                    <input type='text' name="cate_add_show_options_fun[]" value='<php> echo $coder_log["cate_add_show_options_fun"][$cate_add_show_num];</php>' >
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">extra_attr</label>
                                <div class="right">
                                    <input type='text' name="cate_add_show_extra_attr[]" value='<php> echo $coder_log["cate_add_show_extra_attr"][$cate_add_show_num];</php>' >
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">默认值</label>
                                <div class="right">
                                    <input type='text' name="cate_add_show_default[]" value='<php> echo $coder_log["cate_add_show_default"][$cate_add_show_num];</php>' >
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class="left control-label">tips:</label>
                                <div class="right">
                                    <input type='text' name="cate_add_show_tips[]" value='<php> echo $coder_log["cate_add_show_tips"][$cate_add_show_num];</php>' >
                                </div>
                            </div>
                        </div>
                        <php>$cate_add_show_num++</php>
                        <php>}</php>
                        <div class="col-xs-12">
                            <button type="button" class="btn btn-danger btn-xs pull-right" onclick="$(this).parents('.box').remove();">删除</button>
                        </div>
                    </div>
                    <php>}</php>
                     <div class='row add-panel'>
                        <button type="button" class="btn btn-sm btn-default addField" prefix='cate_'>增加一行</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</block>

<block name='script'>
    <script id="field" type="text/template">
        <div class='row box box-solid'>
            <div class="col-xs-12">
                <div class='form-group'>
                    <label class="left control-label">字段名：</label>
                    <div class="right">
                        <input type='text' class="form-control input text" name='column_name[]' />
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class='form-group'>
                    <label class="left control-label">字段类型：</label>
                    <div class="right">
                        <input type='text' class="form-control input text" name='column_type[]' />
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class='form-group'>
                    <label class="left control-label">必填：</label>
                    <div class="right">
                        <select name='require[]'>
                            <option value='1'>是</option>
                            <option value='0' selected='true'>否</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class='form-group'>
                    <label class="left control-label">注释：</label>
                    <div class="right">
                        <input type='text' class="form-control input text" name='comment[]' />
                    </div>
                </div>
            </div>
            <div class="col-xs-12 list_show_div">
                <div class='form-group'>
                    <label class="left control-label">list show?：</label>
                    <div class='right'>
                        <select name='list_show[]' class='list_show' prefix=''>
                            <option value='1'>是</option>
                            <option value='0' selected='true'>否</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12 add_show_div">
                <div class='form-group'>
                    <label class="left control-label">add show?：</label>

                    <div class="right">
                        <select name='add_show[]' class='add_show' prefix=''>
                            <option value='1'>是</option>
                            <option value='0' selected='true'>否</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <button type="button" class="btn btn-danger btn-xs pull-right" onclick="$(this).parents('.box').remove();">删除</button>
            </div>
        </div>
    </script>
    <script id="add_type_select_field" type="text/template">
        <div class="col-xs-12 add_show_type_div">
            <div class='form-group'>
                <label class="left control-label">字段类型：</label>
                <div class="right">
                    <select name="add_show_type[]">
                        <volist name=":C('FORM_ITEM_TYPE')" id="type">
                            <option value='{$key}'>{$type.0}</option>
                        </volist>
                    </select>
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">调用函数：(只有checkbox 或者 select等类型需要填写)</label>
                <div class="right">
                    <input type='text' name="add_show_options_fun[]">
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">extra_attr</label>
                <div class="right">
                    <input type='text' name="add_show_extra_attr[]">
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">默认值</label>
                <div class="right">
                    <input type='text' name="add_show_default[]">
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">tips:</label>
                <div class="right">
                    <input type='text' name="add_show_tips[]">
                </div>
            </div>
        </div>
    </script>
    <script id="list_type_select_field" type="text/template">
        <div class="col-xs-12 list_show_type_div">
            <div class='form-group'>
                <label class="left control-label">调用类型：</label>
                <div class="right">
                    <select name="list_show_type[]">
                        <option value=''>无</option> 
                        <option value='picture'>图片</option> 
                        <option value='fun'>函数</option>
                        <option value='status'>状态</option>
                    </select>
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">调用函数：(只有函数类型需要填写)</label>
                <div class="right">
                    <input type='text' name="list_show_fun[]">
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">可修改?</label>
                <div class="right">
                    <select name="list_edit[]">
                        <option value=''>否</option>
                        <option value='1'>是</option>
                    </select>
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">下拉查询?</label>
                <div class="right">
                    <select name="list_show_select_search[]">
                        <option value=''>否</option>
                        <option value='1'>是</option>
                    </select>
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">下拉查询函数?</label>
                <div class="right">
                    <input type='text' name="list_show_select_options_fun[]" />
                </div>
            </div>
            <div class='form-group'>
                <label class="left control-label">模糊查询?</label>
                <div class="right">
                    <select name="list_show_like_search[]">
                        <option value=''>否</option>
                        <option value='1'>是</option>
                    </select>
                </div>
            </div>
        </div>
    </script>
    <script type="text/javascript">
        jQuery(document).ready(function ($) {
            $('#save_btn').click(function(){
                $('#form').attr('action','/admin/coder/save');
                $('#form').submit();
            });
            
            $('.addField').click(function () {
                var prefix = $(this).attr('prefix');
                var field_o = $($('#field').clone().html());
                field_o.find('[name]').each(function(){
                    var name = $(this).attr('name');
                    $(this).attr('name', prefix+name);
                    if($(this).attr('prefix') != undefined){
                        $(this).attr('prefix', prefix);
                    }
                })
                $(this).parent().before(field_o);
            });
            
            $('.builder').on('change', '.add_show', function(){
                var prefix = $(this).attr('prefix');
                if($(this).val() == 1){
                    var add_type_select_field = $($('#add_type_select_field').clone().html());
                    add_type_select_field.find('[name]').each(function(){
                        var name = $(this).attr('name');
                        $(this).attr('name', prefix + name);
                    });
                    $(this).parents('.add_show_div').after(add_type_select_field);
                }
                else{
                    $(this).parents('.add_show_div').next().remove();
                }
            });
            
            $('.builder').on('change', '.list_show', function(){
                var prefix = $(this).attr('prefix');
                if($(this).val() == 1){
                    var list_type_select_field = $($('#list_type_select_field').clone().html());
                    list_type_select_field.find('[name]').each(function(){
                        var name = $(this).attr('name');
                        $(this).attr('name', prefix + name);
                    });
                    $(this).parents('.list_show_div').after(list_type_select_field);
                }
                else{
                    $(this).parents('.list_show_div').next().remove();
                }
            });
            
            $('#save_cb').on('change', function(){
                if($(this).is(':checked')){
                    $(this).parent().after("<input type='text' name='save_btn_title' value='' id='save_btn_title'>");
                }
                else{
                    $(this).parent().siblings('#save_btn_title').remove();
                }
            });
        });
    </script>
</block>
